<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
    <title>查询考试成绩</title>
    <link rel="stylesheet" href="css/style.css">
    <link href="css/jquery.searchableSelect.css" rel="stylesheet" type="text/css">
    <script src="js/jquery-1.11.1.min.js"></script>
    <script src="js/jquery.searchableSelect.js"></script>
    <link rel="stylesheet" href="js/layui/css/layui.css">
    <script src="js/layui/layui.js"></script>
</head>
<body class="login-bg">
<div class="login-contain">
    <div class="login-header">
        <p>考试成绩</p>
    </div>
    <div class="form-group">
        <form id="form" class="layui-form">
            <div class="form-item">
                <label id="name" class="layui-form-label" style="width: 89%;text-align:center"></label>
            </div>
            <div class="form-item">
                <label id="scores" class="layui-form-label" style="width: 89%;text-align:center">考试得分：</label>
            </div>
            <div class="form-item">
                <label id="time" class="layui-form-label" style="width: 89%;text-align:center">考试用时：</label>
            </div>
        </form>
    </div>
</div>

<script>
    var theRequest = new Object();
    window.onload = function () {
        var url = location.search; //获取url中"?"符后的字串 ('?modFlag=business&role=1')
        if (url.indexOf("?") != -1) {
            var str = url.substr(1); //substr()方法返回从参数值开始到结束的字符串；
            var strs = str.split("&");
            for (var i = 0; i < strs.length; i++) {
                theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
            }
        }
        var params = {"phone": theRequest.phone};
        $.ajax({
            type: "POST",
            url: "/examSystem/web/personRank",
            data: params,
            dataType: 'json',
            success: function (result) {
                if (result.code == 0) {
                    document.getElementById("name").innerHTML = "姓名：" + result.data.name;
                    document.getElementById("scores").innerHTML = "考试得分：" + result.data.scores;
                    document.getElementById("time").innerHTML = "考试用时：" + result.data.time + "秒";
                    result.data;
                }
            },
            error: function (error) {
                $.modal.alertWarning("获取模版数据失败");
            }
        });
    }
    $(function () {
        $(window).resize();
    });
    //js设置居中
    $(window).resize(function () {
        $(".login-contain").css({
            position: "absolute",
            left: ($(window).width() - $(".login-contain").outerWidth()) / 2,
            top: ($(window).height() - $(".login-contain").outerHeight()) / 2.8
        });
    });

</script>
</body>
</html>
